package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.com.api.entity.ApiT_logerp;

//DAO
public interface T_logerpMapperBase {

	// 根据id查看
	@Select("SELECT * FROM t_logerp  WHERE id = #{id}")
	public ApiT_logerp findT_logerpById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM T_logerp")
	public List<ApiT_logerp> findT_logerps();

	// 添加
	@Insert("INSERT INTO t_logerp (type_id, product_id, goods_id, create_time, update_time, ip) VALUES (#{type_id}, #{product_id}, #{goods_id}, #{create_time}, #{update_time}, #{ip})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insertT_logerp(ApiT_logerp t_logerp);

	// 修改
	@Update("UPDATE t_logerp SET type_id = #{type_id}, product_id = #{product_id}, goods_id = #{goods_id}, create_time = #{create_time}, update_time = #{update_time}, ip = #{ip} WHERE id = #{id}")
	public int updateT_logerp(ApiT_logerp t_logerp);

	// 删除
	@Delete("DELETE FROM t_logerp  WHERE id = #{id}")
	public int deleteT_logerp(Integer id);

	// Foreign keys revelant

	// 删除根据Type_id
	@Delete("DELETE FROM t_logerp  WHERE type_id = #{type_id}")
	public int T_logerpDeleteByType_id(String type_id);

	// 获取根据Type_id
	@Select("SELECT id, type_id, product_id, goods_id, create_time, update_time, ip FROM t_logerp  WHERE type_id = #{type_id}")
	public List<ApiT_logerp> findT_logerpsByType_id(String type_id);

	// region Indexs revelant

	// 获取根据ip
	@Select("SELECT id, type_id, product_id, goods_id, create_time, update_time, ip FROM t_logerp  WHERE ip = #{ip}")
	public List<ApiT_logerp> findT_logerpsByIp(String ip);

}
